#include <pthread.h>
#include <stdio.h>
#define NUM_THREADS 50000

void do_nothing(void* null) {
  int i;
  i = 0;
  pthread_exit(NULL);
}

int main() {
  pthread_t threads[NUM_THREADS];
  int rc, t;
  for (t = 0; t < NUM_THREADS; t++) {
    rc = pthread_create(&threads[t], NULL, do_nothing, NULL);
    if (rc) {
      printf("ERROR; return code from pthread create() is %d\n", rc);
      exit(-1);
    }
    rc = pthread_join(threads[t], NULL);
    if (rc) {
      printf("ERROR; return code from pthread create() is %d\n", rc);
      exit(-1);
    }
  }
  pthread_exit(NULL);
}
